<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use EloquentFilter\Filterable;
use App\Models\Traits\Admin\ActionButtonTrait;

class Goods extends Model
{
    use Filterable, ActionButtonTrait;

    protected $appends = ['actionButton'];
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $actions = ['edit','delete'];
    protected $actionUri = 'goods';

    public function goodsType()
    {
        return $this->belongsTo(GoodsType::class, 'category_id','id');
    }
    //

    protected $fillable = [
        'category_id', 'merchant_id','domainName', 'goods_name','goods_code','good_unit','goods_image','shop_price','goods_content','state'
    ];

    public function getGoodsImageAttribute($value)
    {
        
        return $this->domainName.$value;
    }

}

